<template>
  <j-modal title="填写取消信息" :width="600" :visible="visible" :confirmLoading="loading" switchFullscreen @cancel="handleCancel" @ok="handleOk">
    <a-form-model ref="ruleForm" :rules="rules" :model="form" :label-col="{ span: 4 }" :wrapper-col="{ span: 18 }">
      <a-form-model-item label="原因说明" prop="content">
        <a-textarea v-model="form.content" placeholder="请输入" :auto-size="{ minRows: 4, maxRows: 6 }" />
      </a-form-model-item>
    </a-form-model>
  </j-modal>
</template>
<script>
import * as educationTalk from '@/api/sjsk/help/educationTalk.js'
export default {
  name: 'CancelModal',
  data() {
    return {
      visible: false,
      form: {},
      rules: {
        content: [{ required: true, message: '请输入' }],
      },
      loading:false
    }
  },
  async created() {
  },
  methods: {
    show(record) {
      this.visible = true
      this.form = {}
      this.form.id = record.id
    },
    handleCancel() {
      this.visible = false
    },
    handleOk() {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          this.loading = true
          educationTalk.intCancel(this.form).then(res => {
            if (res.success) {
              this.$message.success(res.message)
              this.$emit('ok');
              this.visible = false
              this.loading = false
            } else {
              this.loading = false
              this.$message.warn(res.message)
            }
          })
            .catch(e => {
              this.loading = false
              this.$message.warn('请求失败！')
            })
        }
      })
    }
  },
}
</script>
<style lang="less" scoped>

</style>
